<?php $this->renderPartial('/admin/menu/content');?>
<h4><?php echo Yii::t('helpdesk','Frequently Asked Questions'); ?></h4><br>
<?php
foreach(Yii::app()->user->getFlashes() as $key => $message){
	echo '<div class="'.$key.'"><p>'.$message."</p></div>\n";
}
?>
<a href="/admin/faqs"><i title="go back" class="fa fa-arrow-left"></i> <?php echo Yii::t('helpdesk','Go back'); ?></a>
<form id="create-ticket" class="form-horizontal" enctype="multipart/form-data" method="post">
<table style="width:100%;" class="table table-bordered table-nonfluid table-condensed">
	<tbody>
    <tr>
    	<td><?php echo Yii::t('helpdesk','Folder'); ?></td>
        <td>
        	<select id="folder" name="folder[]" class="form-control" required>
            	<option value="">-- <?php echo Yii::t('helpdesk','Choose'); ?> --</option>
				<?php foreach($arrFolders as $R): ?>
                <option value="<?php echo $R['category_id']; ?>" <?php if( isset($faq['post_category_id']) && in_array($R['category_id'], $faq['post_category_id'])):?>selected=""<?php endif; ?>> <?php for($i=0; $i<$R['category_level']; $i++): echo '&nbsp;&nbsp;&nbsp;&nbsp;'; endfor;?> <?php echo $R['category_name']; ?></option>
				<?php endforeach; ?>
            </select>
        </td>
   	</tr>
    <tr>
    	<td><?php echo Yii::t('helpdesk','Question'); ?></td>
        <td>
        	<input type="text" required="" class="form-control" id="title" name="title" style="width:100%" value="<?php echo isset($faq['post_title'])?$faq['post_title']:null; ?>">
        </td>
   	</tr>
    
	<tr>
		<td valign="top"><?php echo Yii::t('helpdesk','Answer'); ?></td>
		<td><textarea style="width: 100%" name="body" rows="5" class="form-control"><?php echo isset($faq['post_body'])?$faq['post_body']:null; ?></textarea></td>
	</tr>
		
</tbody>
</table>

<input type="submit" class="btn btn-large btn-primary" value="<?php echo !empty($intId)?Yii::t('helpdesk','Update'):Yii::t('helpdesk','Add new'); ?>">
</form>
<script type="text/javascript" src="libs/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="js/ckeditor_configs.js"></script>
<script type="text/javascript">
$(function(){
	CKEDITOR.replace( 'body', ck_full_editor);
});
</script>